package com.water.smartfarm.tools;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2016/6/4.
 */
public class DBHelper extends SQLiteOpenHelper {

    //数据库版本
    private static final int VERSION = 1;
    //新建一个表
    String sql = "create table if not exists USER"+
            "(id int primary key,name varchar,pass varchar,phone varchar,time varchar)";

    public DBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory,
                    int version) {
        super(context, name, factory, version);
    }

    public DBHelper(Context context,String name,int version){
        this(context,name,null,version);
    }

    public DBHelper(Context context,String name){
        this(context,name,VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }

}